// //0XE8
// make_helper(call_rel16);

#include "cpu/exec/template-start.h"

#define instr call
// #define DATA_BYTE 4

//call指令的真正实现
make_helper(call_rel16) {
    // 解析参数
    int len = concat(decode_i_, SUFFIX)(eip + 1);
    // Log("addr = %x", cpu.eip + len + 1);
    //跳转地址
    // Log("call addr = %x", cpu.eip + len + 1 + (int16_t)op_src->val);
    //将当前指令的下一条指令的地址压栈
    cpu.esp -= DATA_BYTE;
    swaddr_write(cpu.esp, DATA_BYTE, cpu.eip + len + 1);
    //跳转
    cpu.eip += (int16_t)op_src->val;
    print_asm("call %x", cpu.eip + len + 1);
    return DATA_BYTE + 1;
}


#include "cpu/exec/template-end.h"